import { router } from './Router.js'
import { createPinia } from 'pinia'
import 'ant-design-vue/dist/reset.css';
import './assets/Common.css'
import { Segmented } from 'ant-design-vue'
Segmented.props.value.type = undefined;

import { UseTabsStore } from './store/Tabs.js';
import { UseMenuStore } from './store/Menu.js';
import Dict from './directive/dict.js'
import { GetDict, SetGetDictAjax, SetDict } from './directive/dict.js'


const modules = import.meta.glob('@/@base/**/*/install.js', { eager: true });



const logoutEvent = function () {
    const TabsStroe = UseTabsStore();
    const MenuStore = UseMenuStore();
    TabsStroe.clear();
    MenuStore.clear();

}


export default {
    install(app) {
        app.use(router);
        app.use(createPinia());

        // 字典项处理
        app.use(Dict);
        app.provide('GetDict', GetDict);
        app.provide('SetGetDictAjax', SetGetDictAjax);
        app.provide('SetDict', SetDict);


        // 登出情理缓存功能
        app.provide('logoutEvent', logoutEvent);


        for (const key in modules) {
            app.use(modules[key].default)
        }
    }
}


export const SetMenuEvent = function () {

}